cmake_minimum_required(VERSION 3.16)
project(simple_pass LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(LLVM REQUIRED CONFIG)
message(STATUS "Using LLVM from ${LLVM_DIR}")

list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_DIR}")
include(AddLLVM)

add_library(SimplePass SHARED src/SimplePass.cpp)
target_include_directories(SimplePass PRIVATE ${LLVM_INCLUDE_DIRS})
target_compile_definitions(SimplePass PRIVATE ${LLVM_DEFINITIONS})
llvm_map_components_to_libnames(LLVM_LIBS core passes irreader support)
target_link_libraries(SimplePass PRIVATE ${LLVM_LIBS})
